
package ogame.utilities;

import ogame.utilities.research.Research;
import java.util.LinkedList;
import ogame.utilities.planets.Planet;
import ogame.utilities.planets.Planets;

/**
 *
 * @author scchang
 */
public class Player {
    protected String name;
    protected Planets planets;
    protected Research research;
    
    public Player(String name){
        this.planets = new Planets();
        this.name = name;
        this.research = new Research();
    }
    
    public void addPlanet(Planet planet){
        planet.setPlayer(this);
        this.planets.add(planet);
    }
    
    public Planets getPlanets(){
        return this.planets;
    }
    
    public int getNumPlanets(){
        return this.planets.size();
    }
    
    public Planet getPlanet(int id){
        return this.planets.get(id);
    }

    public String getName() {
        return name;
    }

    /**
     * @return the research
     */
    public Research getResearch() {
        return research;
    }

    /**
     * @param research the research to set
     */
    public void setResearch(Research research) {
        this.research = research;
    }
    
    public String toString(){
        String output = "Player: " + this.name + '\n';
        output += "Research:\n" + this.research.toString();
        for(Planet planet: this.planets){
            output += planet.toString();
        }
        
        return output;
    }

}
